package realQuestion.threeQuick;

public class Main {

    public static void result(int[] cur, char[] wait) {
        int  M = wait.length;
        int N = cur.length;
        int[] result = new int[M];
        for (int i = 0; i < M; i++) {
            char c = wait[i];
            if (c == 'M') {
                boolean flag = true;
                int temp = 0;
                //   寻找第一张有一个人坐的餐桌
                while (temp < N) {
                    if (cur[temp] == 1) {
                        result[i] = temp+1;
                        cur[temp] += 1;
                        flag = false;

                        break;
                    }
                    temp++;
                }
                if (flag) {
                    for (int j = 0; j < N; j++) {
                        if (cur[j] == 0) {
                            result[i] = j+1;
                            cur[j] += 1;
                            break;
                        }
                    }
                }
            }
            if (c == 'F') {
                boolean flag = true;
                int temp = 0;

                while (temp < N) {
                    if (cur[temp] == 0) {
                        result[i] = temp+1;
                        cur[temp] += 1;
                        flag = false;

                        break;
                    }
                    temp++;


                }
                if (flag) {
                    for (int j = 0; j< N; j++) {
                        if (cur[j] == 1) {
                            result[i] = j+1;
                            cur[j] += 1;
                            break;
                        }
                    }
                }


            }

        }

        for(int i=0;i<M;i++){
            System.out.println(result[i]);
        }


    }




    public static void main(String[] args) {
//        Scanner in = new Scanner(System.in);
//        int T = in.nextInt();
//        int N = in.nextInt();
//        int[] cur = new int[N];
//        for (int i = 0; i < N; i++) {
//            cur[i] = in.nextInt();
//        }
//        int M = in.nextInt();
//        char[] wait = new char[M];
//        String s = in.nextLine();
//        for (int i = 0; i < s.length(); i++) {
//            wait[i] = s.charAt(i);
//        }
        char[] wait1={'M','F','M','M','F','F'};
        int[] cur1={0,1,1,0,2};
        result(cur1,wait1);
    }
}
